package aop.aspectj;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

/**
 * Created by Administrator on 2017/3/28/028.
 */
@Aspect
public class MyAspectj {
    @Before("execution(public * *(..))")
    public void before(){
        System.out.println("+++++前置增强++++++++++");
    }
    @AfterReturning(pointcut = "execution(public * *(..))",returning = "value")
    public Object after(Object value){
        System.out.println("+++++++++++++++后置增强");
        return value;
    }
    @Around("execution(public * *(..))")
    public Object around(ProceedingJoinPoint jp) throws Throwable {
        System.out.println("环绕前置");
        Object proceed = jp.proceed();
        System.out.println("环绕后置");
        return proceed;
    }
    @AfterThrowing("execution(public * *(..))")
    public void Throw(){
        System.out.println("发生异常");
    }
    @After("execution(public * *(..))")
    public void After(){
        System.out.println("最终");
    }
}
